//=============================================================================
// Deagle Pickup.
//=============================================================================
class DeagleWPickup extends SRKFWeaponPickup;

function bool CheckCanCarry(KFHumanPawn Hm)
{
	local Inventory CurInv;
	local bool bHasDeagle;

	for ( CurInv = Hm.Inventory; CurInv != none; CurInv = CurInv.Inventory )
	{
		if ( KFWeapon(CurInv) != none && CurInv.class.Name == 'DeagleW' )
		{
			bHasDeagle = true;
		}
	}

	if (	!Hm.CanCarry(Class<KFWeapon>(InventoryType).Default.Weight) && 
			InventoryType.Name != 'DeagleW')
	{
		if ( LastCantCarryTime < Level.TimeSeconds && PlayerController(Hm.Controller) != none )
		{
			LastCantCarryTime = Level.TimeSeconds + 0.5;
			PlayerController(Hm.Controller).ReceiveLocalizedMessage(Class'KFMainMessages', 2);
		}
		return false;
	}

	if ( InventoryType.Name == 'DeagleW' )
	{
		if ( !bHasDeagle && !Hm.CanCarry(Class<KFWeapon>(InventoryType).Default.Weight) )
		{
			LastCantCarryTime = Level.TimeSeconds + 0.5;
			PlayerController(Hm.Controller).ReceiveLocalizedMessage(Class'KFMainMessages', 2);
			return false;
		}
	}
	return true;
}

function Inventory SpawnCopy( Pawn Other )
{
	local Inventory I;

	for( I=Other.Inventory; I!=None; I=I.Inventory )
	{
		if( DeagleW(I)!=None )
		{
			if( Inventory!=None )
				Inventory.Destroy();
			InventoryType = Class'DualDeagleW';
			I.Destroyed();
			I.Destroy();
			return Super.SpawnCopy(Other);
		}
	}
	InventoryType = Default.InventoryType;
	return Super.SpawnCopy(Other);
}

defaultproperties
{
     Weight=3.000000
     cost=500
     AmmoCost=15
     BuyClipSize=7
     PowerValue=65
     SpeedValue=35
     RangeValue=60
     Description="50 Cal AE handgun. A powerful personal choice for personal defense."
     ItemName="Handcannon"
     ItemShortName="Handcannon"
     AmmoItemName=".300 JHP Ammo"
     showMesh=SkeletalMesh'KF_Weapons3rd_Trip.Handcannon_3rd'
     CorrespondingPerkIndex=2
     EquipmentCategoryID=1
     InventoryType=Class'PerksSimHostOrg.DeagleW'
     PickupMessage="You got the Handcannon"
     PickupSound=Sound'KF_HandcannonSnd.50AE_Pickup'
     PickupForce="AssaultRiflePickup"
     StaticMesh=StaticMesh'KF_pickups_Trip.pistol.deagle_pickup'
     CollisionHeight=5.000000
}
